.TH std::chrono::current_zone 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::chrono::current_zone \- std::chrono::current_zone

.SH Synopsis
   Defined in header <chrono>
   const std::chrono::time_zone* current_zone();  \fI(since C++20)\fP

   Convenience function for obtaining local time zone from the time zone database.
   Equivalent to std::chrono::get_tzdb().current_zone().

.SH Exceptions

   std::runtime_error if this is the first reference to the time zone database and the
   time zone database cannot be initialized.

.SH Notes

   A call to this function that is the first reference to the time zone database will
   cause it to be initialized.

.SH Example


// Run this code

 #include <chrono>
 #include <iostream>

 int main() {
     const std::chrono::zoned_time cur_time{ std::chrono::current_zone(),
                                             std::chrono::system_clock::now() };
     std::cout << cur_time << '\\n';
 }

.SH Possible output:

 2021-09-13 19:46:42.249182012 MAGT

.SH See also

   current_zone   return the local time zone
                  \fI(public member function of std::chrono::tzdb)\fP
   get_tzdb
   get_tzdb_list  accesses and controls the global time zone database information
   reload_tzdb    \fI(function)\fP
   remote_version
   (C++20)
